<template>
  <div>
    <!-- 4.在home组件里面使用标签的方式去使用子组件 -->
    <Category /><!-- 单标签的写法-->
    <ListContainer />
    <TodayRecommend />
    <Rank />
    <Like />
    <Floor
      v-for="floor of floorList"
      :key="floor.id"
      :carouselList="floor.carouselList"
    />
    <Brand />
  </div>
</template>
<script>
// 2导入子组件
import Brand from "@/pages/Home/Brand";
import Floor from "@/pages/Home/Floor";
import Like from "@/pages/Home/Like";
import ListContainer from "@/pages/Home/ListContainer";
import Rank from "@/pages/Home/Rank";
import TodayRecommend from "@/pages/Home/TodayRecommend";
import { mapState, mapGetters } from "vuex";
export default {
  name: "Home",
  // 3.注册组件
  components: {
    Brand,
    Floor,
    Like,
    ListContainer,
    Rank,
    TodayRecommend,
  },
  data() {
    return {};
  },
  activated() {},
  created() {},
  computed: {
    ...mapState({
      floorList: (state) => state.home.floorList,
    }),
  },
  mounted() {
    //通过vuex.store往home.js里面action里面派发一个getFloorList的请求
    this.$store.dispatch("getFloorList");
  },
  methods: {},
};
</script>
<style lang="scss" scoped>
</style>
